package pro01;
import java.io.*;
import java.util.*;
public class Goods {
	public static void main(String args[]) {
		String filePath = "D:/我的/ec/Goods.txt";
		File file = new File(filePath);
		Scanner pr = null;
		int count = 0;
		double sum = 0;
		try { double price =0;
		      pr = new Scanner(file);
		      pr.useDelimiter("[^0123456789.]+");
		      while(pr.hasNextDouble()) {
		          price = pr.nextDouble();
		          count++;
		          sum = sum+price;
		          
		          System.out.println(price);
		    }
		      double aver = sum/count;
		      String str = String.format("%.3f", aver);
		      System.out.println("平均价格："+str);
		}
		catch (Exception exp) {
			System.out.println(exp);
		}
		
	}
	
}
		
		
		
	


